#ifndef SESSION_CONNECTION_H
#define SESSION_CONNECTION_H

#include "MsnConnection.h"

#include "MsnMessage.h"

class FileTransferConnection;

class MsnSession;

class SessionConnection : public MsnConnection
{
typedef std::map<int, P2PMessage*> P2PMessageMap;

protected:
    bool passive;
    wxString sessionID;
    wxString ticket;

	P2PMessageMap p2pMessageMap;

	MsnSession* session;

public:
	SessionConnection(MsnSession* ms, bool mode);
    virtual ~SessionConnection();

public:
    bool IsPassive(){return passive;}

    void SetTicket(const wxString& auth){ticket = auth;}
    void SetSessionID(const wxString& sid){sessionID = sid;}

protected:
    virtual void ConnectionOpened();
    virtual void ConnectionFailed();
    virtual void ConnectionClosed();
    virtual void ConnectionBroken();

    //virtual void ProcessCommand(const wxString& line);
	virtual void ProcessCommand(MsnCommandWrapper* cmdWrapper);

    void ProcessUSR(MsnCommandWrapper* wrapper);
    void ProcessMSG(MsnCommandWrapper* wrapper);
	void ProcessACK(MsnCommandWrapper* wrapper);
	void ProcessNAK(MsnCommandWrapper* wrapper);

    void ProcessCAL(MsnCommandWrapper* wrapper);
    void ProcessJOI(MsnCommandWrapper* wrapper);
    void ProcessANS(MsnCommandWrapper* wrapper);
    void ProcessIRO(MsnCommandWrapper* wrapper);
    void ProcessBYE(MsnCommandWrapper* wrapper);

public:

	void SendMessage(MsnMessage& msg);

	void SendMessage(MsnMessage& msg, int& transID);

	void CallContact(const wxString& contact);

};


#endif

